<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    827. Expressive Words
   </h1>
   <p>
    Sometimes people repeat letters to represent extra feeling, such as "hello" -&gt; "heeellooo", "hi" -&gt; "hiiii".&nbsp; In these strings like "heeellooo", we have
    <em>
     groups
    </em>
    of adjacent letters that are all the same:&nbsp; "h", "eee", "ll", "ooo".
   </p>
   <p>
    For some given string
    <code>
     S
    </code>
    , a query word is
    <em>
     stretchy
    </em>
    if it can be made to be equal to
    <code>
     S
    </code>
    by any&nbsp;number of&nbsp;applications of the following
    <em>
     extension
    </em>
    operation: choose a group consisting of&nbsp;characters
    <code>
     c
    </code>
    , and add some number of characters
    <code>
     c
    </code>
    to the group so that the size of the group is 3 or more.
   </p>
   <p>
    For example, starting with "hello", we could do an extension on the group "o" to get "hellooo", but we cannot get "helloo" since the group "oo" has size less than 3.&nbsp; Also, we could do another extension like "ll" -&gt; "lllll" to get "helllllooo".&nbsp; If
    <code>
     S = "helllllooo"
    </code>
    , then the query word "hello" would be stretchy because of these two extension operations:&nbsp;
    <code>
     query = "hello" -&gt; "hellooo" -&gt;&nbsp;"helllllooo" = S
    </code>
    .
   </p>
   <p>
    Given a list of query words, return the number of words that are stretchy.&nbsp;
   </p>
   <p>
    &nbsp;
   </p>
   <pre>
<strong>Example:</strong>
<strong>Input:</strong> 
S = "heeellooo"
words = ["hello", "hi", "helo"]
<strong>Output:</strong> 1
<strong>Explanation:</strong> 
We can extend "e" and "o" in the word "hello" to get "heeellooo".
We can't extend "helo" to get "heeellooo" because the group "ll" is not size 3 or more.
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Notes:
    </strong>
   </p>
   <ul>
    <li>
     <code>
      0 &lt;= len(S) &lt;= 100
     </code>
     .
    </li>
    <li>
     <code>
      0 &lt;= len(words) &lt;= 100
     </code>
     .
    </li>
    <li>
     <code>
      0 &lt;= len(words[i]) &lt;= 100
     </code>
     .
    </li>
    <li>
     <code>
      S
     </code>
     and all words in
     <code>
      words
     </code>
     &nbsp;consist only of&nbsp;lowercase letters
    </li>
   </ul>
   <p>
    &nbsp;
   </p>
  </div>
  <div>
   <h1 class="question_title">
    827. 情感丰富的文字
   </h1>
   <p>
    有时候人们会用额外的字母来表示额外的情感，比如 "hello" -&gt; "heeellooo", "hi" -&gt; "hiii"。我们将连续的相同的字母分组，并且相邻组的字母都不相同。我们将一个拥有三个或以上字母的组定义为扩张状态（extended），如第一个例子中的 "e" 和" o" 以及第二个例子中的 "i"。 此外，"abbcccaaaa" 将有分组&nbsp;"a" , "bb" , "ccc" , "dddd"；其中 "ccc" 和 "aaaa" 处于扩张状态。
   </p>
   <p>
    对于一个给定的字符串 S ，如果另一个单词能够通过将一些字母组扩张从而使其和 S 相同，我们将这个单词定义为可扩张的（stretchy）。我们允许选择一个字母组（如包含字母&nbsp;
    <code>
     c
    </code>
    &nbsp;），然后往其中添加相同的字母&nbsp;
    <code>
     c
    </code>
    &nbsp;使其长度达到 3 或以上。注意，我们不能将一个只包含一个字母的字母组，如 "h"，扩张到一个包含两个字母的组，如 "hh"；所有的扩张必须使该字母组变成扩张状态（至少包含三个字母）。
   </p>
   <p>
    输入一组单词，输出其中可扩张的单词数量。
   </p>
   <pre>
<strong>示例：</strong>
<strong>输入：</strong> 
S = "heeellooo"
words = ["hello", "hi", "helo"]
<strong>输出：</strong>1
<strong>解释</strong>：
我们能通过扩张"hello"的"e"和"o"来得到"heeellooo"。
我们不能通过扩张"helo"来得到"heeellooo"因为"ll"不处于扩张状态。
</pre>
   <p>
    <strong>
     说明：
    </strong>
   </p>
   <ul>
    <li>
     <code>
      0 &lt;= len(S) &lt;= 100
     </code>
     。
    </li>
    <li>
     <code>
      0 &lt;= len(words) &lt;= 100
     </code>
     。
    </li>
    <li>
     <code>
      0 &lt;= len(words[i]) &lt;= 100
     </code>
     。
    </li>
    <li>
     <code>
      S
     </code>
     &nbsp;和所有在&nbsp;
     <code>
      words
     </code>
     &nbsp;中的单词都只由小写字母组成。
    </li>
   </ul>
  </div>
 </body>
</html>